<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.Cityanalysis,com.ejoysoft.common.Constants,com.ejoysoft.common.exception.NoRightException" %>
<%@page import="sun.reflect.generics.tree.IntSignature"%>
<%@page import="com.ejoysoft.common.Format"%>
<%@ page import="java.util.List"%>
<%@ page import="com.ejoysoft.citygraph.*"%>
<%@page import="java.util.Random"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@ include file="../include/jsp/head.jsp"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'regional_coverage.jsp' starting page</title>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.4"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="../css/main.css" rel="stylesheet" type="text/css" />
	<script language="JavaScript" src="../include/date/popc.js"></script>
	<script src="../include/js/list.js"></script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
  <%
  
  	Cityanalysis task0 = null;
	Cityanalysis obj = new Cityanalysis(globa);

	//获取所有地市
	String where = "";
	List<String> listcity = obj.returnCity(where);	
	
	List<String> data = new ArrayList<String>();
	List<String> links = new ArrayList<String>();
	List<String> data1 = new ArrayList<String>();
	List<String> links1 = new ArrayList<String>();
	
	//分别对每个城市进行热点信息统计
	for(int i=0;i<listcity.size();i++){
		///////////////统计每个城市的热点总数，记为count1///////////////
		where = "where strcity= '"+listcity.get(i)+"'";
		int count1 = obj.returnHpcount(where);
		//System.out.println("各个不同城市的热点总数："+count1);
		
		data.add(Double.toString(count1));
		links.add("");
		
		//////////////统计每个城市已测试的热点数目,记为count2///////////////
		//由测试结果表得到所有已测任务的任务ID，再由已测任务ID得到该任务的热点ID,而后由热点ID找到某城市的已测热点的数量
		where = "";
		int count2 = obj.returntestedHpcount(where,listcity.get(i));
		data1.add(Double.toString(count2));
		links1.add("");
		System.out.println(listcity.get(i)+"总热点数为："+count1+",已测热点数为:"+count2);		
	}
  
	//int max = 50;
	//List<String> data = new ArrayList<String>();
	//List<String> links = new ArrayList<String>();
	//产生折线上的数据点，共六个，存入data中
	/*for(int i = 0; i < 6; i++) {
	    int m=(int)(Math.random() * max);
	    if(m<20)
	    m=m+30;
		data.add(Double.toString(m));
		links.add("");
	}*/

	Graph g = new Graph();
	//坐标标题
	g.title("地市热点分析", "{font-size: 25px;}");
	
	g.set_data(data);
	g.set_data(data1);
	
	g.line(2, "0x9933CC", "热点数", 10, 2);
	g.line_hollow("2", "4", "0x80a033", "已测热点数", "10");

	g.set_links(links);
	
	// label each point with its value
	List<String> labels = new ArrayList<String>();
	for(int i=0;i<listcity.size();i++){
		labels.add(listcity.get(i));
	}
	
	g.set_x_labels(labels);
	g.set_x_label_style("20", "#FF0000", 0,1, "");
	g.set_x_legend("地市热点统计图", -1, "#736AFF");
	
	// set the Y max
	g.set_y_max(20);
	// label every 20 (0,20,40,60)
	g.y_label_steps(5);
%>
<%=g.render()%>
  </body>
</html>
<%@ include file="../include/jsp/footer.jsp"%>
